<template>
  <a-card :bordered="false">
    <keep-alive include="memberList">
    <component @onEdit="handleEdit" @onOrder="handleOrder" @onGoBack="handleGoBack" :record="record"
               :is="currentComponet"></component>
    </keep-alive>
  </a-card>
</template>

<script>
  import memberTrade from './memberTradeList'
  import memberOrder from './memberOrderList'
  import memberList from './memberList'

  export default {
    name: 'info',
    components: {
      memberTrade,
      memberOrder,
      memberList
    },
    data () {
      return {
        currentComponet: 'memberList',
        record: ''
      }
    },
    methods: {
      handleEdit (record) {
        this.record = record
        this.currentComponet = 'memberTrade'
      },
      handleOrder (record) {
        this.record = record
        this.currentComponet = 'memberOrder'
      },
      handleGoBack () {
        this.record = ''
        this.currentComponet = 'memberList'
      }

    },
    watch: {
      '$route.path' () {
        this.record = ''
        this.currentComponet = 'memberList'
      }
    }
  }
</script>